import React from 'react';
import {inject, observer} from 'mobx-react';
import * as mobx from 'mobx';
import {WeaLocaleProvider, WeaSearchGroup, WeaTools} from "ecCom";

const getLabel = WeaLocaleProvider.getLabel;
const Base64 = WeaTools.Base64;

export default class Main extends React.Component {
    constructor(props) {
        super(props);
    }

    renderRemark2() {
        let remarkChangeLog = {}, showName1 = null, showName2 = null;
        const {hasRemark} = this.props;

        if (hasRemark) {
            remarkChangeLog = this.props.remarkChangeLog;
            showName1 = remarkChangeLog.showName1;
            showName2 = remarkChangeLog.showName2;

            if (!!showName1) {
                showName1 = Base64.decode(showName1);
            }

            if (!!showName2) {
                showName2 = Base64.decode(showName2);
            }
        }

        if (hasRemark) {
            return (
                <WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@n9hw50`} showGroup={true} title={getLabel(17614, "签字意见")}>
                    <div dangerouslySetInnerHTML={{__html: showName2}}></div>
                    <div className="red" dangerouslySetInnerHTML={{__html: showName1}}></div>
                </WeaSearchGroup>
            );
        } else {
            return null;
        }
    }

    renderRemark1() {
        let remarkChangeLog = {}, showName = null;
        const {hasRemark} = this.props;

        if (hasRemark) {
            remarkChangeLog = this.props.remarkChangeLog;
            showName = remarkChangeLog.showName;

            if (!!showName) {
                showName = Base64.decode(showName);
            }
        }

        if (hasRemark) {
            return (
                <WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@c786du`} showGroup={true} title={getLabel(17614, "签字意见")}>
                    <div dangerouslySetInnerHTML={{__html: showName}}></div>
                </WeaSearchGroup>
            );
        } else {
            return null;
        }
    }

    render() {
        const {checkResult} = this.props;

        if (checkResult === "2") {
            return this.renderRemark2();
        } else {
            return this.renderRemark1();
        }
    }
}